# -*- coding: utf-8 -*-

"""
@Author: shuangxing
@Date: 2025/04/29
@Description: DifyConfig类用于存储和管理Dify的配置信息，包括访问令牌和刷新令牌。
"""
class DifyConfig:
    _instance = None
    _access_token = None
    _refresh_token = None

    def __new__(cls):
        if cls._instance is None:
            cls._instance = super().__new__(cls)
        return cls._instance

    @classmethod
    def get_access_token(cls):
        return cls._access_token

    @classmethod
    def update_tokens(cls, access_token, refresh_token):
        cls._access_token = access_token
        cls._refresh_token = refresh_token

    @classmethod
    def clear_tokens(cls):
        cls._access_token = None
        cls._refresh_token = None
